package com.cans;

/**
 * 抽象审批类
 *
 * @author cans
 * @date 2022/4/26
 **/
public abstract class AbstractApprove {

    /**
     * 经理
     */
    public static final int MANAGER = 1;
    /**
     * 总监
     */
    public static final int CHIEF = 2;
    /**
     * 总裁
     */
    public static final int PRESIDENT = 3;

    private int lv;

    public int getLv() {
        return lv;
    }

    public void setLv(int lv) {
        this.lv = lv;
    }

    private AbstractApprove nextApprove;

    public void nextApprove(AbstractApprove nextApprove) {
        this.nextApprove = nextApprove;
    }

    /**
     * 进行审批
     *
     * @param username 用户名
     * @param amount   金额
     * @return
     */
    public void sendApprove(String username, Double amount) {
        this.approve(username,amount);
        if (this.nextApprove != null) {
            this.nextApprove.sendApprove(username, amount);
        }
    }

     abstract void approve(String username,Double amount);
}
